/**
* -------------------------------------------------------------
* @author  cl
* @date: 2021-12-28 17:28:05
* @description: 上传文件bind表 controller
* -------------------------------------------------------------
* @version 1.0.0
* @Copyright (c) 中科星图-版权所有
*/
package com.geovis.boot.service.demo.file.controller;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.geovis.boot.common.dto.Result;
import com.geovis.boot.common.util.RedisUtils;
import com.geovis.boot.common.util.ResultUtil;
import com.geovis.boot.service.demo.file.entity.File;
import com.geovis.boot.service.demo.file.entity.FileBind;
import com.geovis.boot.service.demo.file.entity.FileInfo;
import com.geovis.boot.service.demo.file.service.IFileBindService;
import com.geovis.boot.service.demo.file.service.IFileService;
import com.geovis.boot.service.demo.file.vo.FileInfoVO;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@Slf4j
@RestController
@Api(description = "文件信息")
@RequestMapping("/file")
public class FileController {

    @Autowired
    private IFileService iFileService;

    //sql语句查询方式
    @RequestMapping(value = "/getFileBindByParam", method = RequestMethod.GET)
    @ApiOperation(value = "通过id获取")
    public Result<FileInfoVO> getFileBindById(@RequestBody FileInfo fileInfo){

        FileInfo fileBind = iFileService.selectFileBinds(fileInfo);
        FileInfoVO fileInfos = new FileInfoVO();
        BeanUtils.copyProperties(fileBind, fileInfos);
        return new ResultUtil<FileInfoVO>().setData(fileInfos);
    }
}
